/**
 * 
 */
package com.mediasol.commons.log4j;

import java.io.File;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.variables.IValueVariable;
import org.eclipse.core.variables.IValueVariableInitializer;

/**
 * @author david
 *
 */
public class LogsDirInitializer implements IValueVariableInitializer {

	/* (non-Javadoc)
	 * @see org.eclipse.core.variables.IValueVariableInitializer#initialize(org.eclipse.core.variables.IValueVariable)
	 */
	public void initialize(IValueVariable variable) {
		IPath data = Activator.getDefault().getStateLocation();
		IPath logs = data/*.removeLastSegments(3).append("logs")*/;
		File file = logs.toFile();
		if (!file.exists()) {
			file.mkdir();
		}
		variable.setValue(file.getAbsolutePath());
		System.out.println("Log4J Logs: " + variable.getValue());
	}

}
